package corewarsxxi.gui;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Random;
import javax.swing.JPanel;

/**
 *
 * @author ei10139
 */
public class CanvasMemoryCell extends JPanel
{
    CanvasMemoryCell(final Canvas parent)
    {
        super();
        this.setMaximumSize(new Dimension(5, 5));
        this.setCursor(new Cursor(Cursor.HAND_CURSOR));
        Random r = new Random();
        this.setBackground(Color.black);

        this.setPreferredSize(new Dimension(5, 5));
        this.addMouseListener(new MouseListener() {
            public void mouseClicked(MouseEvent e) {
                parent.updateDebuggerOffset(CanvasMemoryCell.this);
            }

            public void mousePressed(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
        });
    }
}
